Skip to content

A grid with no items keeps its explicit tracks - #2484

Merged
ccheever merged 1 commit into
expo:mainfrom
Weesofficial:taffy-empty-grid-tracks
Dec 1, 2026
Merged

ccheever merged 1 commit into
expo:mainfrom
Weesofficial:taffy-empty-grid-tracks

Conversation

@Weesofficial

Copy link
Copy Markdown
Contributor

In the vendored Taffy (vendor/taffy/src/tree/taffy_tree.rs), TaffyView::compute_child_layout ran the grid algorithm only for (Display::Grid, true), a grid with children. A childless display: grid fell through to the measure function and sized as an empty leaf. CSS Grid 1 §7.1 says explicit tracks exist without items, and Chrome sizes such a grid to its tracks.

Case (Chrome 156 as oracle) Chrome Before
block holding grid-template-rows: 22px 30px; gap: 4px 300 x 56 300 x 0
shrinking flex column, grid-template-columns: 40px 10px (with padding) 62 x 28 6 x 6
flex row: empty grid 1fr 50px, then a sibling grid 50 wide, sibling at x=50 grid 0 wide, sibling at x=0
the same with one display:none child (control) matches matches

Empty grids used as spacers, or grids whose items are all conditionally absent, collapsed and moved their siblings.

Fix (Exact patch 85, with its EXACT-PATCHES.md entry): a new dispatch arm (Display::Grid, false) if !has_context => tree.grid(node_id, inputs). Measured leaves (text) keep their measure function. Upstream Taffy dispatches the same way.

Test: kernel/tests/it/browser_cases.rs::a_grid_with_no_items_keeps_its_explicit_tracks (Chrome 156 values), failing without the fix. cargo test -p exact-kernel --lib and --test it pass (every existing Chrome fixture included), fmt, clippy on taffy and scripts/caps.mjs pass. Found with a differential layout fuzz against Chrome.

TaffyView::compute_child_layout ran the grid algorithm only for a grid with children, so a childless display: grid fell through to the measure function and sized as an empty leaf: grid-template-rows: 22px 30px; gap: 4px in a block was 0 tall instead of 56, and an empty 1fr 50px grid in a flex row was 0 wide, moving its sibling. CSS Grid 1 (7.1) has explicit tracks without items and Chrome sizes such a grid to them. A childless grid without a measure context now runs the grid algorithm (Exact patch 85); measured leaves keep their measure function.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-12-01T11:10:45.194056Z
We couldn’t complete this review. Comment @codex review to try again.
18df3ff PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ccheever
ccheever merged commit f875ff7 into expo:main Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants